package com.lc.projects.thread;

import java.util.ArrayList;
import java.util.List;

public class Test {
	private final void test(){
		System.out.println("final test...");
	}
	
	public static void main(String[] args) {
		List<Integer> list = new ArrayList<>();
		int i = 3;
		int j = 8;
		if(isRight(i, j)  == 0){
			list = getNum(i, j);
		}else{
			System.out.println("不互质");
		}
		
		System.out.println(list);
		
	}
	
	
	public static List<Integer> getNum(int i, int j){
		List<Integer> list = new ArrayList<>();

		int start = 1;
		while(list.size() < 10){
			if((j*start + 1) % i == 0){
				list.add((j*start + 1) / i);
			}
			
			start++;
		}
		
		return list;
	}
	
	
	public static int isRight(int i,int j){
		int re = 0;
		if(i < j){
			for (int k = 2; k <= i; k++) {
				if(i % k == 0 && j % k == 0){
					re = k;
					return k;
				}
			}
		}else {
			for (int k = 2; k <= j; k++) {
				if(i % k == 0 && j % k == 0){
					re = k;
					return k;
				}
			}
		}
		
		return re;
	}
}




